
using UnityEngine;

namespace HyuFrameWork
{
    public class MutiAudioHub : AudioHub
    {
        protected override AudioController SpawnNew(string newName = "")
        {
            if (newName == "")
                newName = gameObject.name + "Ctrl" + (audios.Count + 1);
            var newObj = new GameObject(newName,typeof(AudioSource),typeof(AudioController));
            newObj.transform.SetParent(transform);
            newObj.transform.localPosition = Vector3.zero;
            var newSourceCtrl = newObj.AddComponent<AudioController>();
            newSourceCtrl.Init(this);
            onCtrlInit(newSourceCtrl);
            audios.Add(newSourceCtrl);
            return newSourceCtrl;
        }
    }
}